package com.im.partchat.http.service;

import com.im.partchat.bean.FriendApply;
import com.im.partchat.bean.reponsed.BaseResponse;
import com.im.partchat.bean.request.FriendAddRequest;
import com.im.partchat.bean.request.FriendConfirmRequest;
import com.im.partchat.bean.request.FriendDeleteRequest;
import com.im.partchat.bean.request.FriendListRequest;
import com.im.partchat.bean.request.RequestBean;
import com.im.partchat.http.api.FriendApi;
import com.im.partchat.http.apiManager.ApiManager;

import java.util.List;

import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;

/**
 * Created by hhz on 2017/7/3.
 */

public class FriendService {

    private static FriendApi friendApi  = ApiManager.getInstance().getApi(FriendApi.class);

    public static Observable<BaseResponse<List<String[]>>> friendList(RequestBean<FriendListRequest> requestRequestBean) {
        return friendApi.friendList(requestRequestBean)
                .observeOn(AndroidSchedulers.mainThread())
                .subscribeOn(Schedulers.io());
    }
    public static Observable<BaseResponse<Object>> friendApplyAdd(RequestBean<FriendAddRequest> requestRequestBean) {
        return friendApi.friendApplyAdd(requestRequestBean)
                .observeOn(AndroidSchedulers.mainThread())
                .subscribeOn(Schedulers.io());
    }
    public static Observable<BaseResponse<Object>> friendApplyConfirm(RequestBean<FriendConfirmRequest> requestRequestBean) {
        return friendApi.friendApplyConfirm(requestRequestBean)
                .observeOn(AndroidSchedulers.mainThread())
                .subscribeOn(Schedulers.io());
    }

    public static Observable<BaseResponse<Object>> friendDelete(RequestBean<FriendDeleteRequest> requestRequestBean) {
        return friendApi.friendDelete(requestRequestBean)
                .observeOn(AndroidSchedulers.mainThread())
                .subscribeOn(Schedulers.io());
    }

    public static Observable<BaseResponse<List<FriendApply>>> friendApplyList(RequestBean<FriendListRequest> requestRequestBean) {
        return friendApi.friendApplyList(requestRequestBean)
                .observeOn(AndroidSchedulers.mainThread())
                .subscribeOn(Schedulers.io());
    }

}
